package com.gupaoedu.dubbo.dubboclient;

import com.gupaoedu.dubbo.ISayHelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: JLL
 * @Date: 2019/8/1 0:40
 */
@RestController
public class DubboController {

    @Reference(loadbalance = "roundrobin",
            timeout = 1,  //正常来说，1毫秒是处理不完的
            cluster = "failfast", //默认是重试3次，调的比较慢
            mock = "com.gupaoedu.dubbo.dubboclient.SayHelloServiceMock",
            //这里check=false的含义：动态代理生成这个接口的实现类的时候，如果server端没有启动，后面可以去重连，这里先不检查
            check = false)
    ISayHelloService isayHelloService;


    @GetMapping(value = "/sayHello")
    public String sayHello(){
        return isayHelloService.sayHello();
    }


}
